import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import { ReqPage } from "../interface";

export const roleMenuList = (roleId: number | undefined) => {
  return http.get<RoleMenu.ResRoleMenu[]>(PORT1 + `/sys-role-menu/role/menu/${roleId}`);
};

export const saveRoleMenu = (data: RoleMenu.ReqRoleMenu) => {
  return http.post<Boolean>(PORT1 + `/sys-role-menu/save/rights`, data);
};

export namespace RoleMenu {
  export interface ResRoleMenu {
    id: number;
    roleId: number;
    menuId: number;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
  export interface ReqRoleMenu extends ReqPage {
    id: number;
    roleId: number;
    menuId: number;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
}
